/**
 * 
 */
package insigne.gui.mainFrame.lookAndFeel;

import java.util.Collection;
import java.util.Iterator;
import java.util.Map;

import org.pushingpixels.substance.api.SubstanceLookAndFeel;
import org.pushingpixels.substance.api.skin.SkinInfo;

/**
 * Return a look and feel from a given name or randomly
 * @author Xavier
 */
public class LookAndFeelGetter {
	/* ############################### Fields ############################### */
	private Map<String, SkinInfo> laf;
	/* ########################## Getters And Setters ####################### */

	/* ########################### Class Constructors ####################### */
	/** Class constructor */
	public LookAndFeelGetter() {
		laf = SubstanceLookAndFeel.getAllSkins();
	}
	
	/* ############################### Methods ############################## */
	/** return a random look and feel class name */
	public String random(){
		Collection<SkinInfo> skin_infos = laf.values();
		int size = skin_infos.size();
		Iterator<SkinInfo> iterator = skin_infos.iterator();
		int random = (int)Math.round(Math.random() * size);
		SkinInfo si = null;
		for (int i = 0; i < random; i++) {
			si = iterator.next();
		}
		System.out.println(si.getClassName());
		return si.getClassName();
	}
}
